<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/index.css">
</head>

<body>
    <div id="header">
        <h2>商品列表</h2>
        <button id="carsBtn">我的购物车</button>
    </div>
    <div id="main">
        <ul id="productList">

        </ul>
    </div>
    <script src="./js/jquery-3.6.0.js"></script>
    <script src="./js/util.js"></script>
    <script src="./js/template-web.js"></script>
    <!-- 商品列表模板 -->
    <script id="shopsList" type="text/html">
        {{each shopList}}
        <li>
            <div class="p-img">
                <a target="_blank" href="//item.jd.com/33950552707.html">
                    <img width="220" height="220" data-img="1" src="{{$value.pic1}}">
                </a>
            </div>
            <div class="p-price">
                <strong><span>￥</span>{{$value.unitPrice}}</strong>
            </div>
            <div class="p-name">
                <a target="_blank" href="//item.jd.com/33950552707.html">
                    <span>{{$value.name}}</span>
                </a>
            </div>
            <div class="p-addToShoppingCart">
                <button class="detailsPage" data_index="{{$value.id}}">查看详情</button>
                <button class="addToShoppingCartBtn" data_index="{{$value.id}}">加入购物车</button>
            </div>
        </li>
        {{/each}}
    </script>
    <script src="./js/index.js"></script>
</body>

</html>